package edu.cornell.cs4740.wsd;

public class Word {
	private String word;
	private String pos;
	
	public Word(String word, String pos) {
		this.word = word;
		this.pos = pos;
	}
	
	public Word(String wordAndPos) throws Exception {
		String[] wordPosArr = wordAndPos.split("\\.");
		if(wordPosArr.length != 2) {
			System.err.println(wordPosArr.length);
			throw new Exception("Cannot split " + wordAndPos + " into word/part of speech pair");
		} else {
			word = wordPosArr[0];
			pos = wordPosArr[1];
		}
	}

	public String getWord() {
		return word;
	}

	public void setWord(String word) {
		this.word = word;
	}

	public String getPos() {
		return pos;
	}

	public void setPos(String pos) {
		this.pos = pos;
	}
	
	public String toString() {
		return this.word + "." + this.pos;
	}
	
	
}
